<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Student Subject</title>

<script>
	function goExam(falg,done,examSubjectId){
		if(falg > 0 && done < 1){
			if (confirm("是否确认去考试？")) {
				window.location.href="${pageContext.request.contextPath }/exam/goExam/"+examSubjectId+"";
			}else{
				return false;
			}
		}else{
			alert("你已经考过试了！！")
			return false;
		}
	}
	
	function goGrade(done,examSubjectId){
		if(done>=1){
			if (confirm("是否查看成绩？")) {
				window.location.href="${pageContext.request.contextPath }/exam/goGrade/"+examSubjectId+"";
			}else{
				return false;
			}
		}else{
			alert("你还没考试，考试结束后才能看成绩！");
			return false;
		}
	}
</script>
</head>
<body style="height:780px">
	<table class="table table-hover table-striped table-bordered" 
			cellSpacing="0" cellPadding="0">
		<tr style="text-align: center;" class="info">
				<td>科目Id</td>
				<td>科目名</td>
				<td>科目描述</td>
				<td>科目总题数</td>
				<td>科目总时长</td>
				<td>总分</td>
				<td>是否开放考试</td>
				<td>是否完成考试</td>
				<td>是否考试</td>
				<td>查看成绩</td>
		</tr>
		<c:forEach items="${stuSubjectList }" var="stuSubjectList">
			<tr>
				<tr>
					<td>${stuSubjectList.examSubjectId }</td>
					<td>${stuSubjectList.examSubjectName }</td>
					<td>${stuSubjectList.examSubjectDescription }</td>
					<td>${stuSubjectList.examSubjectTnumber }</td>
					<td>${stuSubjectList.examSubjectTotaltime }</td>
					<td>${stuSubjectList.examSubjectSum }</td>
					<td>
						<c:if test="${stuSubjectList.examSubjectFlag eq '0'}">
							<span class="glyphicon glyphicon-remove"></span>
						</c:if>
						<c:if test="${stuSubjectList.examSubjectFlag eq '1' }">
							<span class="glyphicon glyphicon-ok"></span>
						</c:if>
					</td>
					<td>
						<c:if test="${stuSubjectList.examSubjectDone eq '0'}">
							<span class="glyphicon glyphicon-remove"></span>
						</c:if>
						<c:if test="${stuSubjectList.examSubjectDone eq '1' }">
							<span class="glyphicon glyphicon-ok"></span>
						</c:if>
					</td>
					<td class="danger">
						<span class="glyphicon glyphicon-hand-right" onclick="goExam('${stuSubjectList.examSubjectFlag}','${stuSubjectList.examSubjectDone}','${stuSubjectList.examSubjectId }')"></span>
					</td>
					<td class="danger">
						<span class="glyphicon glyphicon-eye-open" onclick="goGrade('${stuSubjectList.examSubjectDone}','${stuSubjectList.examSubjectId }')"></span>
					</td>
				</tr>
		</c:forEach>
	</table>
</body>
</html>